<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body>
   <div ng-app="myApp" ng-controller="myCon">
       <p ng-bind="num1"></p>
       <p>{{num2}}</p>
   </div>
<script type="text/javascript">
    //1激活应用
    var app=angular.module("myApp",[]);
    //2获取控制器,在回调函数中把服务传递进来，传递可以简单的理解成注入的过程
    //在控制器中获取网址的操作，需要依赖注入的服务
    app.controller("myCon",function ($scope,$location) {
        //获取页面的url地址
       console.log($location);
       $scope.num1=$location.absUrl();
       $scope.num2=$location.$$port;
    });




</script>
</body>
</html>